package day3;

/**
 * ClassName：MyPrint
 *
 * @Author：小鱼
 * @Create：2025-08-20 10:29
 */
public class MyPrint {
    public synchronized  void print1(){
        System.out.print("天");
        System.out.print("天");
        System.out.print("向");
        System.out.print("上");
        System.out.print("\n");
    }
    public static synchronized  void print3(){
        System.out.print("天");
        System.out.print("天");
        System.out.print("向");
        System.out.print("上");
        System.out.print("\n");
    }
    public synchronized  void print2(){
        synchronized (this) {
            try {
                this.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.print("好");
            System.out.print("好");
            System.out.print("学");
            System.out.print("习");
            System.out.print("\n");
        }
    }

}
